package com.selftaught.controller;

import com.selftaught.domain.HospitalUser;
import com.selftaught.service.IHospitalUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * 医院患者 Controller
 *
 * @author huya
 * @date 2025-10-23
 */
@RestController
@RequestMapping("/hospitalUser")
public class HospitalUserController {

    @Autowired
    private IHospitalUserService hospitalUserService;

    /**
     * 扫码新增医院患者
     *
     * @param keyword 关键字
     * @return 结果
     */
    @PostMapping
    public HospitalUser insertHospitalUserByScanCode(String keyword) {
        return hospitalUserService.insertHospitalUserByScanCode(keyword);
    }

    /**
     * 模拟接口
     */
    @PostMapping("/simulation")
    public String simulation() {
        return "<root xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"><header><NHIPlog><status>AA</status></NHIPlog><msgCode>900</msgCode><msgId>048c1a58-c274-44f1-85e4-7e4c3bfc6f49</msgId><type>900</type><createTime>20251023133604</createTime></header><body><items><item><patName>张三</patName><patSex>F</patSex><patAge>51</patAge><patBirth>1973/10/28 0:00:00</patBirth><patAddress>江苏省南京市江宁区丽泽路xx号</patAddress><patMobile>12312312312</patMobile><patIdType>1</patIdType><patIdNo>123123123123123123</patIdNo><patCardType>1</patCardType><patCardNo>0012312312</patCardNo><patientId>1231231231231231</patientId><patType>1</patType><totalAmt>200</totalAmt></item></items></body></root>";
    }
}
